<html>
<head><meta charset="utf-8"><title>Do we want to Broadcast someday? · project-portable-simd · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/index.html">project-portable-simd</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html">Do we want to Broadcast someday?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="242131999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242131999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242131999">(Jun 09 2021 at 21:18)</a>:</h4>
<p>It's probably more of a userlib thing but it's a question that matters I guess to our shiny future if we want to keep it open or not: Do we want to support a notion of "Broadcasting" where e.g. SimdF32&lt;9&gt; + SimdF32&lt;3&gt; works?</p>



<a name="242134172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242134172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242134172">(Jun 09 2021 at 21:37)</a>:</h4>
<p>What would that do?</p>



<a name="242135952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242135952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242135952">(Jun 09 2021 at 21:52)</a>:</h4>
<p>broadcasting is like splatting but it "tiles" the result instead, so in that example it adds elements lhs: 0..3 and rhs: 0..3, lhs 3..6 and rhs: 0..3, rhs 6..9 and lhs 0..3</p>



<a name="242136122"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242136122" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242136122">(Jun 09 2021 at 21:54)</a>:</h4>
<p>I would support a function that did that (if that's even possible to make efficient?) but I don't think I like the idea of it being automatic</p>



<a name="242136191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242136191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242136191">(Jun 09 2021 at 21:55)</a>:</h4>
<p>Broadcasting to me just means splatting (that's what Intel calls it)</p>



<a name="242138117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242138117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242138117">(Jun 09 2021 at 22:15)</a>:</h4>
<p>i think we want this for literals and probably not for anything else.</p>



<a name="242138993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242138993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242138993">(Jun 09 2021 at 22:27)</a>:</h4>
<p>I don't think Rust has a notion of "only literals" here. ^^;;;</p>



<a name="242139154"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242139154" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242139154">(Jun 09 2021 at 22:29)</a>:</h4>
<p>though that raises <strong>another</strong> question, lol<br>
do we want Simd{Int}&lt;4&gt; + [{nt}; 4] to work</p>



<a name="242140677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242140677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242140677">(Jun 09 2021 at 22:47)</a>:</h4>
<p>I don't think most automatic conversions make sense because they're questionably efficient</p>



<a name="242143825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242143825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242143825">(Jun 09 2021 at 23:32)</a>:</h4>
<p>Well this is more cause to have custom literals</p>



<a name="242145410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242145410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242145410">(Jun 09 2021 at 23:56)</a>:</h4>
<p><span class="user-mention silent" data-user-id="312331">Caleb Zulawski</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F/near/242140677">said</a>:</p>
<blockquote>
<p>I don't think most automatic conversions make sense because they're questionably efficient</p>
</blockquote>
<p>so I kinda agree but I <strong>wonder</strong> about that re: array of equivalent size vs. operation on a SIMD type, since aside from using <code>movups</code> to load into memory, it's basically going to be equivalent.</p>



<a name="242145437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242145437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242145437">(Jun 09 2021 at 23:56)</a>:</h4>
<p>Depending what happens that move is potentially exceptionally expensive</p>



<a name="242145462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242145462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242145462">(Jun 09 2021 at 23:57)</a>:</h4>
<p>Not to say vectors can't spill into memory but the compiler will try hard not to</p>



<a name="242145700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242145700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jubilee <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242145700">(Jun 10 2021 at 00:00)</a>:</h4>
<p>I'm more thinking that if something is in memory, it has to be moved into a vector register at some point, so if you want to add an array and a SIMD register, well, it shouldn't casually fall back into an array, so it should only be one-way, but it doesn't seem significantly different re: optimizations.</p>



<a name="242145867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242145867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Caleb Zulawski <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242145867">(Jun 10 2021 at 00:02)</a>:</h4>
<p>Well I agree with that, but then I think you can just use <code>from_array</code></p>



<a name="242146083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257879-project-portable-simd/topic/Do%20we%20want%20to%20Broadcast%20someday%3F/near/242146083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F.html#242146083">(Jun 10 2021 at 00:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281757">Jubilee</span> <a href="#narrow/stream/257879-project-portable-simd/topic/Do.20we.20want.20to.20Broadcast.20someday.3F/near/242139154">said</a>:</p>
<blockquote>
<p>do we want Simd{Int}&lt;4&gt; + [{nt}; 4] to work</p>
</blockquote>
<p>I'd say that's an easy cut from v1.  It can always be added later.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>